/*******************************************************************************
 * Copyright (c) 2010, 2030 www.mahao.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package cn.itlaobing.web.servlet;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext;

/** 
 * ClassName: DispachServlet <br/> 
 * Function: TODO 功能描述 <br/> 
 * date: 2017年5月11日 上午10:38:04 <br/> 
 * 
 * @author Mmmmm 
 * @version  
 * @since JDK 1.8 
 */
@WebServlet("/hello")
public class DispachServlet extends HttpServlet {
	Log log = LogFactory.getLog(DispachServlet.class);
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		ServletContext sc = this.getServletContext();
		Enumeration<String> em = sc.getAttributeNames();
		while(em.hasMoreElements()){
			String key = em.nextElement();
			Object value = sc.getAttribute(key);
			log.info(key+">>>>>>>>>>>>>>>>>"+value.getClass().getName());
			if(value instanceof WebApplicationContext){
				log.info("找了Spring容器了！！！");
			}
		}
	}
	
}
